﻿using Avalonia.Data.Converters;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyTodo.Common.Converters
{
    public class IntToVisibilityConverter : IValueConverter
    {
        
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool IsVisible = false;
            if (value != null && int.TryParse(value.ToString(), out int result))
            {
                if (result == 0)
                {
                    IsVisible = true;
                    return IsVisible;
                }
            }
            IsVisible = false;
            return IsVisible;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
